package br.edu.ufcg.greengrid.report;

import java.util.List;

import br.edu.ufcg.greengrid.model.Grid;
import br.edu.ufcg.greengrid.model.Simulator;
import br.edu.ufcg.greengrid.model.job.Job;

import com.mallardsoft.tuple.Quintuple;
import com.mallardsoft.tuple.Tuple;

public class JobMakespanReporter extends AbstractReporter<Quintuple<String, Long, Long, Long, Integer>> {

	// <submitTime> <runtime> <actualRuntime> <finished?>

	public JobMakespanReporter(long randomValue) {
		super(randomValue);
	}

	@Override
	public void cleanUp(Simulator s) {
		Grid grid = s.getGrid();
		List<Job> jobs = grid.getJobs();
		for (Job j : jobs) {
			add(Tuple.from(j.getId(), j.getSubmitTime(), j.getRuntime(), j.getMakespan(), j.done() ? 1 : 0));
		}
	}

	@Override
	protected String getReportName() {
		return "job-makespan";
	}

}
